package com.swiftride.autoconfigure;

import com.swiftride.properties.CosProperties;
import com.swiftride.template.CosTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({CosProperties.class})
public class CosAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(
            name = {"fileTemplate"}
    )
    public CosTemplate fileTemplate(CosProperties cosProperties) {
        return new CosTemplate(cosProperties);
    }
}
